package com.yizhubao.app.adapters;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yizhubao.app.R;
import com.yizhubao.app.beans.ListRecordBean;
import com.yizhubao.app.utils.Constants;
import com.yizhubao.app.utils.Utils;

import java.util.List;

import h.framework.pacy.P;
import h.framework.pacy.utils.DateUtil;
import h.framework.pacy.utils.StringUtil;

/**
 * @author Pacy.
 * Date: 2021/6/4/004
 * Time: 21:18
 * Mail pengwwe457621023@qq.com
 * Info
 */
public class HomeAdapter extends BaseQuickAdapter<ListRecordBean.ListBean, BaseViewHolder> {
    public HomeAdapter() {
        super(R.layout.home_item);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, ListRecordBean.ListBean item) {
        helper.setText(R.id.title_tv, DateUtil.formartDate(item.getUpdateTime()));
        if (item.getType() == 1) {
            //日常记录
            if (StringUtil.isEmpty(item.getSummary())) {
                helper.setText(R.id.content_tv, "点击查看详细内容");
            } else {
                helper.setText(R.id.content_tv, item.getSummary());
            }
        } else {
            //专业遗嘱
            helper.setText(R.id.content_tv, "点击查看详细内容");
        }

        if(Utils.isPay()){
            //已支付
            helper.setText(R.id.lable_tv,"保障中")
                    .setTextColor(R.id.lable_tv, P.getContext().getResources().getColor(R.color.btn_color_green));
        }else{
            //未支付
            helper.setText(R.id.lable_tv,"待支付")
                    .setTextColor(R.id.lable_tv, P.getContext().getResources().getColor(R.color.red));
        }

    }
}
